<template>
  <div class="difference">
    <!-- <crumbs :BreadCrumb="BreadCrumb"></crumbs> -->
    <div class="asas">
    <div class="top" style="margin-left:20px; margin-right:20px; margin-bottom: 20px;">
      <div class="wenzi">旅客信息</div>
      <el-table size="mini" :data="a" border style="width: 100%">
        <el-table-column prop="date" label="旅客姓名" width="180">
        </el-table-column>
        <el-table-column prop="name" label="证件号" width="180">
        </el-table-column>
        <el-table-column prop="address" label="客票号"> </el-table-column>
      </el-table>
    </div>
    <div class="top" style="margin-left:20px; margin-right:20px; margin-bottom: 20px;">
      <div class="wenzi">原航信息</div>
      <el-table size="mini" :data="olgData1"  border style="width: 100%">
        <el-table-column prop="date" label="出发机场" width="120">
        </el-table-column>
        <el-table-column prop="name" label="到达机场" width="130">
        </el-table-column>
        <el-table-column prop="address" label="出发时间"> </el-table-column>
        <el-table-column prop="name" label="到达时间" width="180">
        </el-table-column>
        <el-table-column prop="name" label="航班号" width="100">
        </el-table-column>
         <el-table-column prop="name" label="舱位" width="100">
        </el-table-column>
      </el-table>
    </div>
    <div class="top" style="margin-left:20px; margin-right:20px; margin-bottom: 20px;">
      <div class="wenzi">改期后的航班信息</div>
      <el-table size="mini" :data="olgData1"  border style="width: 100%">
         <el-table-column prop="orgAirportName" label="出发机场" width="120">
        </el-table-column>
        <el-table-column prop="dstAirportName" label="到达机场" width="130">
        </el-table-column>
        <el-table-column prop="depDate" label="出发时间"> </el-table-column>
        <el-table-column prop="arrDate" label="到达时间" width="180">
        </el-table-column>
        <el-table-column prop="flightNo" label="航班号" width="100">
        </el-table-column>
         <el-table-column prop="cabin" label="舱位" width="100">
        </el-table-column>
      </el-table>
    </div>
    <div class="bottom">
      <el-button  style="background-color:#499D93; color:#fff;" @click="save">确认改期</el-button>
      <el-button >取消</el-button>
    </div>
    </div>
  </div>
</template>

<script>
import crumbs from "../../components/Crumbs.vue";
export default {
  name: "difference",
  components: {
    crumbs,
  },
  data() {
    return {
      olgData:{},
      olgData1:[],
      item:[],
      orders:[],
       cabin:"",
      baseCabin:"",
      a:[],
      orderId:"",
      ticketNo:"",
      price:'',
      BreadCrumb: [
        { path: "/flight/reserve", name: "机票查询" },
        { path: "/reserve/flightlist", name: "机票列表" },
        { path: "/reserve/flightschedule", name: "填写订单" },
      ],
      change:{},
      aaaa:{
        ticketPrice:1960
      }
    };
  },
  methods: {

    // 保存订单信息
    save() {
      console.log(this.olgData)
      let style = this.olgData.planeTypeDesc.slice(0,3)
      this.$axios.getchangeCreateOrder({
          // 航班号
          flightNo:this.olgData.flightNo,
          // 舱位
          cabin:this.cabin,
          // 出发时间
          departureTime:this.olgData.depDate.split(' ').join('T'),
          // 到达时间
          arrTime:this.olgData.arrDate.split(' ').join('T'),
          // 机型
          planeStyle:style,
          // 订单号
          orderId:this.orders.orderId,
          // 票号
          ticketNo:this.orders.ticketNo,
          // 燃油费
          oilFee:this.olgData.ticketNo?this.olgData[0].ticketNo:"",
          // 机建费
          tax:this.olgData.tax?this.olgData[0].tax:"",
          // 出发机场航站楼
          orgTerminal:this.olgData.depTerm,
          // 抵达机场航站楼
          dstTerminal:this.olgData.arrTerm,
          // 票价
          ticketAmount:this.price
        })
        .then((res) => {
          console.log(res);
          if (res.code == "200") {
            this.$message({
          message: '保存订单成功',
          type: 'success'
        });
            this.change = res.data
          }
        });
    },
    endorse(){
      let list = this.olgData
      let a = list.planeTypeDesc.slice(0,3)
      let arr = {
        equipment:a,
        departureTime:list.depDate,
        arrivalTime:list.arrDate,
        flightNo:list.flightNo,
        cabin	:this.cabin,
        ticketNo:this.orders.ticketNo,
        orderId:this.change.msg,
        price:this.aaaa.ticketPrice
        // differencePrice:this.price>this.orders.


      }
     this.$router.push({name:'pay',params: {id:'1',
      orders:this.orders,
      baseCabin:this.baseCabin,
      cabin:this.cabin,
      olgData:this.olgData
      }})
    }
  },
  mounted() {
      this.orders = this.$route.params.orders
      console.log(this.orders)
        //  等级
      this.baseCabin = this.$route.params.baseCabin
      console.log(this.baseCabin);
        // 舱位
      this.cabin = this.$route.params.cabin
      console.log(this.cabin);
      this.olgData = this.$route.params.olgData
      console.log(this.olgData);
      this.price = this.$route.params.price
  },
};
</script>
<style>
.difference {
  height: 100%;
  background-color: #f7f7f7;
}
.wenzi{
  margin-bottom: 10px;
}
.bottom{
  float: right;
  margin-right: 20px;
  margin-bottom: 30px;
}
.asas{
  width: 1000px;
  margin: auto;
}

</style>
